Skip to content

Conversation

@Kaleb-Reid
Copy link
Contributor

@Kaleb-Reid Kaleb-Reid commented Nov 1, 2025

There was already a method to get the port but I could not find a way to get the address. I noticed that the wildcard addresses have weird behaviour, not sure if I need to document that or where I would.

According to ss on Linux, when using the built-in ENet using * or :: as the bind address will actually bind to * and be accessible over IPv4 and 6, but using enet_socket_get_address will return ::. When using 0.0.0.0 as the bind address, enet_socket_get_address will return 0.0.0.0 but the socket will be bound to ::ffff:0.0.0.0 and will be accessible over IPv4 normally, but can only be accessed by IPv6 using an IPv4-mapped IPv6 address (e.g. ::ffff:7f00:1 / ::ffff:127.0.0.1).

When not using the built-in ENet, * and 0.0.0.0 will bind to 0.0.0.0 and enet_socket_get_address will return 0.0.0.0.

Given that setting :: and * both result in * being bound I chose to always return *. I also chose to leave 0.0.0.0 because its functionality is actually different from * and ::.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants